import Vue from 'vue'
import CryptoJS from '@/common/crypto-js.js'
const keys = 'abcdefgabcdefg12';
export default {
    AES_encrypt(word) {
        var key = CryptoJS.enc.Utf8.parse(keys);
        var srcs = CryptoJS.enc.Utf8.parse(word);
        var encrypted = CryptoJS.AES.encrypt(srcs, key, {
            mode: CryptoJS.mode.ECB,
            padding: CryptoJS.pad.Pkcs7
        });
        return encrypted.toString();
    },
    AesEncrypt(word, keys) {
        var key = CryptoJS.enc.Utf8.parse(keys);
        var srcs = CryptoJS.enc.Utf8.parse(word);
        var encrypted = CryptoJS.AES.encrypt(srcs, key, {
            mode: CryptoJS.mode.ECB,
            padding: CryptoJS.pad.Pkcs7
        });
        return encrypted.toString();
    },
    AES_decrypt(word) {
        var key = CryptoJS.enc.Utf8.parse(keys);
        var decrypt = CryptoJS.AES.decrypt(word, key, {
            mode: CryptoJS.mode.ECB,
            padding: CryptoJS.pad.Pkcs7
        });
        return CryptoJS.enc.Utf8.stringify(decrypt).toString();
    },
    AesDecrypt(word, keys) {
        var key = CryptoJS.enc.Utf8.parse(keys);
        var decrypt = CryptoJS.AES.decrypt(word, key, {
            mode: CryptoJS.mode.ECB,
            padding: CryptoJS.pad.Pkcs7
        });
        return CryptoJS.enc.Utf8.stringify(decrypt).toString();
    }

}
